/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chalmers.se.tda367.utils;

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;

/**
 *
 * @author malinanker
 */
public class ImageFilter extends FileFilter {

    @Override
    public boolean accept(File file) {
        if (file.isDirectory()) {
            return true;
        }
        String extension = ImageFilterUtils.getExtension(file);
        if (extension != null) {
            if (extension.equals(ImageFilterUtils.tiff)
                    || extension.equals(ImageFilterUtils.tif)
                    || extension.equals(ImageFilterUtils.gif)
                    || extension.equals(ImageFilterUtils.jpeg)
                    || extension.equals(ImageFilterUtils.jpg)
                    || extension.equals(ImageFilterUtils.png)) {
                return true;
            } else {
                return false;
            }

        }
        return false;
    }

    @Override
    public String getDescription() {
        return "Bilder";
    }
}
